ShowTable of Contents
Overview
The accounts framework provides name, password credentials to various back-end servers. If required, Axis web services can be used in conjunction with the accounts framework to provide WS security data to the application server.
Web Service
The details of the web service are covered in another
sample
. The web service simply returns the time from the remote server.
Creating the Axis Web Service Client
Creating the client is very straight-forward. Using the WSDL from the web service:
- Create a client services project to contain the WSDL file.
- Select the WSDL file in the project explorer.
- Right mouse-click -> Web Services -> Generate Client.
- Select the Apache Axis for Client Services type and remaining default options.
Assigning the Account
The wizard will update the plugin.xml to enable account integration. The plugin XML appears as the following.
<extension
point="com.ibm.pvc.jndi.provider.java.binding">
<binding
jndi-name="com.ibm.rcp.support.ws.remote.RemoteSystem"
objectFactory-id="com.ibm.rcp.ws.objectfactory.WSObjectFactory">
</binding>
</extension>
<extension
point="com.ibm.rcp.ws.objectfactory.WSfactoryobject">
<WSobject
account-key="Axis Sample"
class="com.ibm.rcp.support.ws.remote.RemoteSystem"
jndi-name="com.ibm.rcp.support.ws.remote.RemoteSystem">
</WSobject>
</extension>
Ensure the account-key value reflects an existing account. In the example, the account references a WebSphere Application Server v6.1 using LDAP security.
Using the Account
When the web service client executes the following occurs.
- The Axis Sample account is retrieved by the Expeditor platform.
- An authentication request is made to the authentication URL in the account.
- A WS security header is constructed to contain the LTPA token obtained from step 2.
- The header and SOAP envelop are posted to the web service address obtained from the web service client code.
To ensure the platform creates an authenticated request using the web service, you must obtain the client code through JNDI.
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.pvc.jndi.provider.java.InitialContextFactory");
InitialContext ic = new InitialContext(env);
RemoteSystem rs = (RemoteSystem) ic.lookup("com.ibm.rcp.support.ws.remote.RemoteSystem");
System.out.println(rs.getSystemTime());